package com.rd.student.jiaji.class3.zhangshixuan.Day0731;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Demo03 {
    public static void main(String[] args) {
        ArrayList list = new ArrayList();
        for (int i = 0; i < 50; i++) {
            list.add(i);
        }
        ArrayList<Integer> allList = new ArrayList<>(list.size());
        for (int i = 0; i < list.size(); i++) {
            allList.add((Integer) list.get(i));
        }
        Collections.shuffle(allList);
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入要随机的个数:");
        int n = sc.nextInt();
        System.out.println("最终结果为:");
        for (int i = 0; i < n; i++) {
            System.out.println(allList.get(i));
        }
    }
}
